﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class App_Common_UserControls_CustomerNavBar : System.Web.UI.UserControl
{
    protected void lblWelcome_Load(object sender, EventArgs e)
    {
        SetWelcomeText((Label)sender);
    }

    private void SetWelcomeText(Label lblWelcome)
    {
        lblWelcome.Text = "Welcome ";
        ProfileCommon profileCommon = Profile.GetProfile(Page.User.Identity.Name);
        if (profileCommon.DisplayName.Length > 0)
            lblWelcome.Text += profileCommon.DisplayName;
        else
            lblWelcome.Text += Page.User.Identity.Name;
    }

    protected void lnStatus_LoggingOut(object sender, LoginCancelEventArgs e)
    {
        FormsAuthentication.SignOut();
        Session.Abandon();
        Response.Redirect("~/Default.aspx", true);
    }
}
